home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / 4cmp22s.zip / STRINGS1.4TH < prev    next >
Text File  |  1994-10-30  |  2KB  |  64 lines

  1. \ STRING SUPPORT LIBRARY PART 1
  2. \ Contents Copyright (C) 1986, 1993 by Thomas Almy
  3.  
  4. \ Permission is granted to registered users of ForthCMP to sell or distribute
  5. \ computer programs incorporating the compiled contents of this file.
  6.  
  7. \ This file must be loaded BEFORE the application program.
  8. \ Then load STRINGS2.4TH before FORTHLIB.
  9.  
  10. \ When separate code and data segments are used, beware that
  11. \ string literals are in the code segment.  Use STR>DSEG
  12. \ to move to string buffer ( in DSEG ).
  13.  
  14.  
  15. .( Loading STRINGS ) CR
  16. 10 DECIMAL
  17.  
  18. FIND StringSize [IF] DROP [ELSE]
  19.  
  20. 1024 CONSTANT StringSize  \ alter if desired.
  21.  
  22. \ For instance, to have a 512 byte buffer instead of the default 1024, start
  23. \ the source file "xxx MSDOS  512 CONSTANT StringSize  INCLUDE STRINGS1".
  24.  
  25. [THEN]
  26.  
  27. DSEG
  28.  
  29. FIND strbufr [IF] DROP [ELSE]
  30.  
  31. CREATE strbufr  StringSize ALLOT
  32. \ you might also want to put strbufr at some arbitrary high constant
  33. \ location so that the size of the COM/EXE file is not increased:
  34. \   PSIZE StringSize - 1000 ( size of stacks ) - CONSTANT strbufr
  35. \ placed before INCLUDEing this file
  36.  
  37. \ While the example shows the string buffer at a fixed location, it can
  38. \ be dynamically positioned at program startup if the VALUEs STRBUF and
  39. \ strend are set as well. In this case, strbufr should be declared to be a
  40. \ VALUE: "xxx MSDOS  0 VALUE strbufr  INCLUDE STRINGS1". In MAIN, the following
  41. \ code can be executed: "HERE DUP TO strbufr  DUP TO STRBUF  TO strend
  42. \ StringSize ALLOT"
  43.  
  44. [THEN]
  45.  
  46. strbufr VALUE STRBUF 
  47. strbufr VALUE strend
  48.  
  49. 1 0 IN/OUT NEED +STRBUF
  50. 2 2 IN/OUT NEED STR>DSEG
  51. 2 0 IN/OUT NEED STRCPY
  52. 2 1 IN/OUT NEED STRPCK
  53. 1 1 IN/OUT NEED ASCIIZ
  54. 1 1 IN/OUT NEED -ASCIIZ
  55. 2 2 IN/OUT NEED -PATH
  56. 2 1 IN/OUT NEED -EXT
  57. 2 1 IN/OUT NEED +EXT
  58. 0 1 IN/OUT NEED argc
  59. 2 1 IN/OUT NEED -ASCIIZL
  60. 1 1 IN/OUT NEED argv
  61. 2 1 IN/OUT NEED getenv
  62.  
  63. 16 = [IF] HEX [THEN]
  64.